package io.homework2;

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;

/**
 * 缓冲流实现文件的复制
 */
public class Test1 {
    public static void main(String[] args) throws Exception {
        FileInputStream fis = new FileInputStream("hw.txt");
        BufferedInputStream bis = new BufferedInputStream(fis);
        FileOutputStream fos = new FileOutputStream("hw1.txt");
        BufferedOutputStream bos = new BufferedOutputStream(fos);
        int b;
        while ((b=bis.read())!=-1){
            bos.write(b);
        }
        System.out.println("复制完成");

        bis.close();
        bos.close();
    }
}
